package gene.android.accountingpro.equations;

import gene.android.accountingpro.finals.EquationNames;
import gene.android.accountingpro.finals.FieldList;

import java.util.ArrayList;
import java.util.List;

public class CurrentRatio extends Equation {
	
	private double currentAssets;
	private double currentLiabilities;
	
	public CurrentRatio(){}

	public CurrentRatio(double currentAssets, double currentLiabilities)
	{
		this.currentAssets = currentAssets;
		this.currentLiabilities = currentLiabilities;
		value = ( currentAssets / currentLiabilities );
	}
	
	public void solve()
	{
		value = ( currentAssets / currentLiabilities );
	}
	
	@Override
	public String getEquationName() {
		
		return EquationNames.CURRENT_RATIO;
		
	}

	@Override
	public List<String> getRequiredFields()
	{
		List<String> requiredFields = new ArrayList<String>();
		requiredFields.add( FieldList.CURRENT_ASSETS );
		requiredFields.add( FieldList.CURRENT_LIABILITES );
		return requiredFields;
	}

	@Override
	public void setValues(double[] values) {
		
		currentAssets = values[0];
		currentLiabilities = values[1];
		solve();
	}

	@Override
	public String getSolvedEquationString() {
		return "( " + currentAssets +" / " +currentLiabilities +" ) = " +value;
	}

	@Override
	public String getEquationString() {
		return "( " + FieldList.CURRENT_ASSETS +" / " +FieldList.CURRENT_LIABILITES +" )";
	}

}
